package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import com.ticket.sass.common.entity.tenant.enums.TicketServerConfigPlatform;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ywb
 * @since 2024-03-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("ticket_server_configs")
@ApiModel(value="TicketServerConfigsEntity对象", description="")
public class TicketServerConfigEntity implements Serializable {
    @ApiModelProperty(value = "售票系统配置 id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "票务服务网址")
    private String serverUrl;

    @ApiModelProperty(value = "售票系统：1 辰星，2 鼎新，3 凤凰云智，4 凤凰佳影，5 火烈鸟，6 vista（沃思达），7 m1905")
    private TicketServerConfigPlatform platform;

    @ApiModelProperty(value = "配置内容，json 格式")
    private String data;

    @ApiModelProperty(value = "影院 id")
    private Long cinemaId;
    
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;
    
    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;
    
    public TicketServerConfigEntity() {
    }
    
    public TicketServerConfigEntity(String serverUrl, TicketServerConfigPlatform platform, String data, Long cinemaId) {
        this.serverUrl = serverUrl;
        this.platform = platform;
        this.data = data;
        this.cinemaId = cinemaId;
    }
    
    public TicketServerConfigEntity(String serverUrl, Short platform, String data, Long cinemaId, Long tenantId) {
        this.serverUrl = serverUrl;
        this.platform = TicketServerConfigPlatform.Companion.valueOf(platform);
        this.data = data;
        this.cinemaId = cinemaId;
        this.tenantId = tenantId;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public Long getCinemaId() {
        return cinemaId;
    }

    public void setCinemaId(Long cinemaId) {
        this.cinemaId = cinemaId;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public LocalDateTime getDeletedAt() {
        return deletedAt;
    }

    public void setDeletedAt(LocalDateTime deletedAt) {
        this.deletedAt = deletedAt;
    }

    public TicketServerConfigPlatform getPlatform() {
        return platform;
    }

    public void setPlatform(TicketServerConfigPlatform platform) {
        this.platform = platform;
    }

    public String getServerUrl() {
        return serverUrl;
    }

    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("TicketServerConfigEntity{");
        sb.append("id=").append(id);
        sb.append(", serverUrl='").append(serverUrl).append('\'');
        sb.append(", platform=").append(platform);
        sb.append(", data='").append(data).append('\'');
        sb.append(", cinemaId=").append(cinemaId);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", deletedAt=").append(deletedAt);
        sb.append('}');
        return sb.toString();
    }
}
